package com.adderis.soft.domain.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author Reda
 * @version 1.0
 * @created 20-avr.-2014 22:47:44
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "viscosite", catalog = "adderis")
public class Viscosite implements java.io.Serializable {

	private int viscositeId;
	private String viscosite;
	private Integer temperature;
	private Date createtimestamp;
	private String statutcode;
	private Date updatetimesstamp;
	private Date deletiontimesstamp;
	private Set<NomCommercial> nomCommercials = new HashSet<NomCommercial>(0);

	public Viscosite() {
	}

	public Viscosite(int viscositeId) {
		this.viscositeId = viscositeId;
	}

	public Viscosite(int viscositeId, String viscosite, Integer temperature) {
		this.viscositeId = viscositeId;
		this.viscosite = viscosite;
		this.temperature = temperature;
	}

	@Id
	@Column(name = "viscositeID", unique = true, nullable = false)
	public int getViscositeId() {
		return this.viscositeId;
	}

	public void setViscositeId(int viscositeId) {
		this.viscositeId = viscositeId;
	}

	@Column(name = "Viscosite", length = 16777215)
	public String getViscosite() {
		return this.viscosite;
	}

	public void setViscosite(String viscosite) {
		this.viscosite = viscosite;
	}

	@Column(name = "Temperature")
	public Integer getTemperature() {
		return this.temperature;
	}

	public void setTemperature(Integer temperature) {
		this.temperature = temperature;
	}

	@Column(name = "createdatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatetimestamp() {
		return createtimestamp;
	}

	public void setCreatetimestamp(Date createtimestamp) {
		this.createtimestamp = createtimestamp;
	}

	@Column(name = "statutcode", length = 10)
	public String getStatutcode() {
		return statutcode;
	}

	public void setStatutcode(String statutcode) {
		this.statutcode = statutcode;
	}

	@Column(name = "updatedatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getUpdatetimesstamp() {
		return updatetimesstamp;
	}

	public void setUpdatetimesstamp(Date updatetimesstamp) {
		this.updatetimesstamp = updatetimesstamp;
	}

	@Column(name = "deletiondatetime")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDeletiontimesstamp() {
		return deletiontimesstamp;
	}

	public void setDeletiontimesstamp(Date deletiontimesstamp) {
		this.deletiontimesstamp = deletiontimesstamp;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "joinnomcommercialtoviscosite", catalog = "adderis", joinColumns = { @JoinColumn(name = "viscositeID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "	nomCommercialID", nullable = false, updatable = false) })
	public Set<NomCommercial> getNomCommercials() {
		return nomCommercials;
	}

	public void setNomCommercials(Set<NomCommercial> nomCommercials) {
		this.nomCommercials = nomCommercials;
	}
}
